package Comprehensive_01;

import java.time.DayOfWeek;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class DateTimeDemo {
    public static void main(String[] args) {
        String user = "2022-11-25 16:59:00";
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime parse = LocalDateTime.parse(user, dtf);
        DayOfWeek dayOfWeek = parse.getDayOfWeek();
        if (dayOfWeek.getValue() == 6) {
            System.out.println("发货日期为:" + parse.plusDays(2L));
        } else if (dayOfWeek.getValue() == 5 && parse.getHour() > 15) {
            System.out.println("发货日期为:" + parse.plusDays(3L));
        } else if (parse.getHour() <= 15){
            System.out.println("发货日期为:" + parse.plusDays(1L));
        } else {
            System.out.println("发货日期为:" + parse.plusDays(2L));
        }

        /*
        if (parse.getHour() > 15) {
            parse = parse.plusDays(2L);
        } else {
            parse = parse.plusDays(1L);
        }
        if (parse.getDayOfWeek().getValue() == 7) {
            System.out.println(parse.plusDays(1L));
        } else {
        System.out.println(parse);
        }*/
    }
}
